Object.defineProperty(exports, "__esModule", {
  value: true
});
var o = cc._decorator.ccclass;
var def_OPPO_InterstitialAdMgr = /* */function () {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
    this.interstitialAd = null;
    this.adKey = false;
  }
  return babel_createClass(_ctor, [{
    key: "init",
    value: function init() {
      var _this60 = this;
      setTimeout(function () {
        _this60.adKey = true;
      }, 35e3);
    }
  }, {
    key: "show",
    value: function show(e) {
      var _this61 = this;
      console.log("创建插屏广告");
      if (window.qg.getSystemInfoSync().minPlatformVersion <= 1061) {
        console.log("快应用平台版本号低于1061，暂不支持插屏 API");
      } else {
        this.interstitialAd = window.qg.createInterstitialAd({
          posId: e
        });
        if (this.interstitialAd) {
          this.interstitialAd.onLoad(function () {
            console.log("插屏广告加载成功");
          }), this.interstitialAd.onClose(this.close.bind(this)), this.interstitialAd.load().then(function () {
            console.log("展示插屏广告");
            _this61.interstitialAd.show();
          }).catch(function (e) {
            console.log(e);
            _this61.close();
          });
        }
      }
    }
  }, {
    key: "close",
    value: function close() {
      if (this.interstitialAd) {
        this.interstitialAd.offClose(this.close.bind(this));
        this.interstitialAd.destroy();
        this.interstitialAd = null;
      }
    }
  }], [{
    key: "Instance",
    get() {
      _ctor._instance || (_ctor._instance = new _ctor());
      return _ctor._instance;
    }
  }]);
}();
exports.default = def_OPPO_InterstitialAdMgr;